package com.ui;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 * Servlet implementation class CodeServlet
 */
@WebServlet("/User/codeq")
public class CodeServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#service(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		
            String code = request.getParameter("code");
			HttpSession session = request.getSession();
			String code1 = (String) session.getAttribute("code");
			
			if (code1.equalsIgnoreCase(code)) {
				response.getWriter().append("1");
		} else {
			response.getWriter().append("0");
		}
	}

}
